const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
  mode: 'development',
  entry: {
    index: './src/index.js',
    pageOne: './src/pageOne/index.js',
  },
  output: {
    filename: 'js/[name].bundle.js',
    clean: true,
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: './src/index.html',
      chunks: ['index'],
      filename: 'index.html',
    }),
    new HtmlWebpackPlugin({
      template: './src/pageOne/index.html',
      chunks: ['pageOne'],
      filename: 'pageOne.html',
    }),
  ],
  devServer: {
    static: './dist',
  },
  optimization: {
    usedExports: true, // 启用 tree shaking,默认就是true
  },
};
